package com.mairuide._frame.utils.excel.annotation;

import java.text.SimpleDateFormat;

/**
 * @Description
 * @auther 刘中华
 * @create 2019-03-15 13:47
 */
public class ExcelAttributeHandle {

    public static final String TIME="time";
    public static final String SIGN="sign";
    public static final String CALL_TYPE="call_type";

    public static String handle(String type, Object val){
        String format= null;
        switch (type){
            case "time":
                SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                if (val instanceof String){
                    format=(String) val;
                }else{
                    format = simpleDateFormat.format(val);
                }
                break;
            case "sign":
                format=Integer.valueOf(val.toString())==0?"流入":"流出";
                break;
            case "call_type":
                Integer integer = Integer.valueOf(val.toString());
                if (integer==0){
                    format="主叫";
                }else if (integer==1){
                    format="被叫";
                }else if (integer==2){
                    format="短信发送";
                }else if (integer==3){
                    format="短信接收";
                }
                break;
        }
        return format;
    }
}
